﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebUI.Admin.UserControls
{
    public delegate void YesEventHandler(object sender);
    public delegate void NoEventHandler(object sender);
    public partial class ConfirmDialogController : System.Web.UI.UserControl
    {
       
        public string DialogTitle { get; set; }
        public string MessageContent { get; set; }
        public object Key { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {

        }


        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Hide();

            if (Yes != null) { Yes(this); }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Hide();

            if (No != null) { No(this); }
        }

        public event YesEventHandler Yes;
        public event NoEventHandler No;

        public void Show()
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "JsModal", "DisplayModal()", true);
            Visible = true;
        }

        public void Hide()
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "JsModal", "RemoveModal()", true);
            Visible = false;
        }
    }
}